package com.enzoism.springboot.dive.bis.datastruct;

/**
 * 自定义链表
 */
public class MyNode {
    public String data;
    public MyNode next;

    public MyNode(String data, MyNode next) {
        this.data = data;
        this.next = next;
    }

    public MyNode(String data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "MyNode{" +
                "data='" + data + '\'' +
                ", next=" + next +
                '}';
    }

    public static void main(String[] args) {
        // 创建一个链表
        MyNode data1 = new MyNode("data1", null);
        System.out.println("------>dada："+data1);
        // 添加一个数据
        MyNode data2 = new MyNode("data2", null);
        data1.next = data2;
        System.out.println("------>dada："+data1);
    }
}
